package com.byxy.ssm.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.byxy.ssm.pojo.TFIntegration;

public interface TFIntegrationMapper {
	@Delete("delete from tab_forum where tab_forum_id=#{tabForumId}")
    int delete(Integer tabForumId);
	
	
	@Insert("insert into tab_forum(tab_id,forum_id) values(#{tabId},#{forumId})") 
	@Options(useGeneratedKeys=true,keyProperty="tabForumId",keyColumn="tab_forum_id")
	/*@SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "id", before = false, resultType = int.class)*/
    void insert(TFIntegration tabForum);

    @Select("select * from tab_forum where tab_forum_id=#{tabForumId}")
    @Results({
    	@Result(id=true,column="tab_forum_id",property="tabForumId"),
    	@Result(column="tab_id",property="tabId"),
    	@Result(column="forum_id",property="forumId")
    })
    TFIntegration getById(Integer tabForumId);
    
    
    
    @Select("select * from tab_forum")
    @Results({
    	@Result(id=true,column="tab_forum_id",property="tabForumId"),
    	@Result(column="tab_id",property="tabId"),
    	@Result(column="forum_id",property="forumId")
    })
    List<TFIntegration> findAll();
    @Update("update tab_forum set tab_id=#{tabId},forum_id=#{forumId} where tab_forum_id=#{tabForumId}")
    int update(TFIntegration tabForum);
}